package cn.wolfcode.service.impl;

import cn.wolfcode.mapper.ConsumptionReportMapper;
import cn.wolfcode.qo.ConsumptionReportQueryObject;
import cn.wolfcode.service.IConsumptionReportService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Map;

@Service
@Transactional
public class ConsumptionReportServiceImpl implements IConsumptionReportService {

    @Autowired
    private ConsumptionReportMapper mapper;
    @Override
    public PageInfo query(ConsumptionReportQueryObject qo) {
        PageHelper.startPage(qo.getCurrentPage(), qo.getPageSize());
        return new PageInfo(mapper.selectForList(qo));
    }

    @Override
    public List<Map<String, Object>> queryForChart(String groupType) {

        return mapper.selectForChart(groupType);
    }
}
